<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新增学员</title>
<!--    导入-->
    <script src="js/jquery-3.6.0.min.js"></script>
    <style>
        button{
            border: 1px solid gray;
            padding: 10px;
            background-color: ghostwhite;
            width: 80%;
        }
        input,label,button{
            margin: 10px;
            font-size: 20px;
            padding: 10px;
        }
    </style>
</head>
<body>
<div style="width: 50%;margin-left: 25%">
    <fieldset>
        <legend>新增学员</legend>
        <form id="fm1">
        <div>
            <label>姓名：</label><input name="name">
        </div>
        <div>
            <label>性别：</label>
            <input type="radio" name="sex" value="女">女
            <input type="radio" name="sex" value="男">男
        </div>
        <div>
            <label>生日：</label><input type="date" name="birthday">
        </div>
        <div><button type="button" onclick="add()">新增学员</button></div>

    </form>
     </fieldset>
</div>
<script>
    function add(){
        //页面调用接口 Ajax
        $.post("/api/student/save.do",$("#fm1").serialize(),function (res){
            if(res.code==200){
                //成功
                alert("OK");
            }else {
                alert("失败");
            }
        })
    }
</script>
</body>
</html>